package top.ldkxingzhe.ldksettings.adapters

import android.support.v7.widget.RecyclerView

/**
 * Created by liangdengke on 2018/10/22.
 */
abstract class BaseAdapter<T: RecyclerView.ViewHolder, D>(var data: List<D>?) : RecyclerView.Adapter<T>() {

    var onItemClickListener: ((index: Int, item: D)-> Unit)? = null

    override fun getItemCount(): Int {
        return data?.size?:0
    }

    fun getItem(index: Int): D{
        return data!![index]
    }
}